
export default {
  name: 'index',
  components: {

  },
  data() {
    const item = {
      date: '2016-05-02',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1518 弄'
    };
    return {
      tableData: Array(20).fill(item)
    }
  },
  mounted() {
    this.startSrcoll()

    //数据初始化
    // this.TiLength =this.$refs.myQuillEditor.quill.getLength()
  },
  methods: {
    getBtn() {
     

      console.log('1', this.value1)
    },
    startSrcoll() {
      let a = JSON.parse(JSON.stringify(this.tableData))
      let _this = this;
      // console.log(this.$refs.everTable.$el);
      let everTable = this.$refs.everTable.$el;
      this.$nextTick(() => {
        console.log(everTable)
        let elwrapper = everTable.getElementsByClassName(
          'el-table__body-wrapper'
        )[0];

        this.elwrapper = elwrapper;

        let elBody = everTable.getElementsByClassName('el-table__body')[0];
        _this.elBody = elBody;

        elBody.style.position = 'absolute';
        elBody.style.transition = 'all 500ms linear';

        setTimeout(() => {
          let elRow = everTable.getElementsByClassName('el-table__row');
          for (let node of elRow) {
            node.style.height = 48 + 'px';  //高度----> 设置每行的高度
          }
          elwrapper.style.height = 4 * 48 + 'px';  //4 -> 页面需要显示的行数
        }, 1000);

        elBody.style.top = 0;

        elBody.style.transactionDuration = 1000 + 'ms';   //滚动时间

        if (_this.isScroll) {
          let b = 0
          _this.timer = setInterval(function () {
            _this.active += 1;
            elBody.style.top =
              parseInt(elBody.style.top) - parseInt(48) + 'px';
            if (
              _this.active <
              parseInt(_this.tableData.length) - parseInt(4) - 1
            ) {

              // _this.active += 1;
              // elBody.style.top =
              //   parseInt(elBody.style.top) - parseInt(30) + 'px';
            } else {

              _this.tableData.push(a[b])
              b++
              if (b > a.length - 1) {
                b = 0
              }
              // if (this.isClear) {
              //   clearInterval(this.timer);
              // }
              if (true) {
                // _this.active = 0;
                // elBody.style.top = 0;
              } else {
                clearInterval(_this.timer);
              }
            }
          }, 1000);
        }
      });
    },
  },
  computed: {
    editor() {
      return this.$refs.myQuillEditor.quill;
    },
  }

};